package com.lagou.config;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * 通过threadLocal获取当前线程所用数据源的key
 * 使用AbstractRoutingDataSource的determineCurrentLookupKey方法选择数据源
 */
public class RoutingDataSource extends AbstractRoutingDataSource {
    @Override
    protected Object determineCurrentLookupKey() {
        return RoutingDataSourceUtil.getDataSourceRoutingKey();
    }
}
